package com.example.demo.mapper;

import com.example.demo.entity.Storage;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StorageMapper {

    @Insert("insert into storage(Sid, Scasenum, Stonnum, Shbelong, Scbelong) values (#{Sid}, #{Scasenum}, #{Stonnum}, #{Shbelong}, #{Scbelong})")
    int createStorage(Storage storage);

    @Delete("delete from storage where Sid = #{Sid}")
    int deleteStorage(Integer Sid);

    @Update("update storage set Isdeleted = 1 where Sid = #{Sid}")
    void updateIsdeleted(Integer Sid);

    @Update("update storage set Shbelong = #{Shbelong}, Scbelong = #{Scbelong} where Sid = #{Sid}")
    int updateStorage(Storage storage);

    @Select("select * from storage where Sid = #{Sid}")
    Storage findStorage(Integer Sid);

    @Select("select * from storage")
    List<Storage> findAllstorages();
}
